/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Abril_4.Ej_10_04_13_01;

import java.io.File;
import static Metodos.MetodosUtiles.*;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;

/**
 *
 * @author vesprada
 */
public class Ej_01 {

    public static void main(String[] args) {
        int contador = 0;



        try {
            File archivo = new File("ej01.txt");
            archivo.delete();
            archivo.createNewFile();
            FileOutputStream fSalida = new FileOutputStream(archivo, true);
            BufferedOutputStream bSalida = new BufferedOutputStream(fSalida);
            DataOutputStream dSalida = new DataOutputStream(bSalida);
//            PrintWriter pw = new PrintWriter(dSalida);
//            for (int i = 1; i <= 100; i++) {
//                dSalida.writeInt(i);
//            }
            ArrayList<Integer> lista = new ArrayList<>();
            for (int i = 0; i < 100; i++) {
                lista.add(i);
            }
            for (int i = 0; i < lista.size(); i++) {
                dSalida.writeInt(lista.get(i));
//                bSalida.flush();
//                dSalida.flush();

            }
            dSalida.flush();
                           fSalida.close();
                           bSalida.close();
                           dSalida.close();

            
        } catch (Exception e) {
            System.out.println("error2");
        }

        

    }
}
